import 'package:flutter/material.dart';

class ProfileInfoPage extends StatelessWidget {
  const ProfileInfoPage({super.key});

  Widget _buildInfoItem(String title, String? value, {VoidCallback? onTap}) {
    return InkWell(
      onTap: onTap,
      child: Container(
        padding: const EdgeInsets.all(16),
        decoration: BoxDecoration(
          color: Colors.white,
          border: Border(
            bottom: BorderSide(
              color: Colors.grey[100]!,
              width: 1,
            ),
          ),
        ),
        child: Row(
          children: [
            Text(
              title,
              style: TextStyle(
                fontSize: 15,
                color: Colors.grey[600],
              ),
            ),
            const SizedBox(width: 16),
            Expanded(
              child: Text(
                value ?? '',
                style: const TextStyle(
                  fontSize: 15,
                  fontWeight: FontWeight.w500,
                ),
                textAlign: TextAlign.right,
              ),
            ),
            if (onTap != null) ...[
              const SizedBox(width: 4),
              Icon(
                Icons.chevron_right,
                size: 20,
                color: Colors.grey[400],
              ),
            ],
          ],
        ),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color(0xFFF5F5F5),
      appBar: AppBar(
        title: const Text('个人信息'),
        centerTitle: true,
        backgroundColor: Colors.white,
        elevation: 0,
      ),
      body: ListView(
        children: [
          const SizedBox(height: 12),
          Container(
            margin: const EdgeInsets.symmetric(horizontal: 12),
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.circular(8),
            ),
            child: Column(
              children: [
                _buildInfoItem(
                  '头像',
                  '',
                  onTap: () {
                    // TODO: 修改头像
                  },
                ),
                _buildInfoItem(
                  '姓名',
                  '张三',
                  onTap: () {
                    // TODO: 修改姓名
                  },
                ),
                _buildInfoItem(
                  '性别',
                  '男',
                  onTap: () {
                    // TODO: 修改性别
                  },
                ),
                _buildInfoItem('手机号', '188****4720'),
                _buildInfoItem(
                  '身份证号',
                  '3****************9',
                ),
                _buildInfoItem(
                  '工号',
                  'SF4720',
                ),
              ],
            ),
          ),
          const SizedBox(height: 12),
          Container(
            margin: const EdgeInsets.symmetric(horizontal: 12),
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.circular(8),
            ),
            child: Column(
              children: [
                _buildInfoItem(
                  '修改密码',
                  '',
                  onTap: () {
                    // TODO: 修改密码
                  },
                ),
                _buildInfoItem(
                  '注销账号',
                  '',
                  onTap: () {
                    // TODO: 注销账号
                  },
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
} 